#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int main()
{
    int x, n = 0;
    scanf("%d%d", &x, &n);
    long long sum = 0;
    do
    {
        while (x >= 1 && x <= 5 && n > 0)
        {
            x++;
            n--;
            sum += 250;
        }
        if (x == 6)
            n -= 2;
        if (x == 7)
            n--;
        x = 1;
    } while (n > 0);
    printf("%lld", sum);
    return 0;
}